Theming
A build function receives the theme next to the root nav. Theme holds the template overrides, CSS and the error page, MaterialTheme adds Material for MkDocs settings (palette, colors, content width, status icons).
Example
import mknodes as mk
def build(root: mk.MkNav, theme: mk.Theme) -> mk.MkNav:
theme.error_page.content = mk.MkAdmonition("Page does not exist!")
if isinstance(theme, mk.MaterialTheme):
theme.content_area_width = 1300
page = root.add_page("Home", is_index=True)
page += "Hello"
return root
mknodes.Theme
class Theme
MkDocs Theme.
mknodes.MaterialTheme
class MaterialTheme(theme.Theme)
Material Theme.
Page info
Code for this page
mknodes.manual.api_section.add_page.
@nav.route.page(title, hide="toc")
def _(page: mk.MkPage) -> None:
page += INTROS[title]
page += mk.MkCode(EXAMPLES[title].rstrip(), language="py", title="Example")
for identifier in identifiers:
page += mk.MkDocStrings(identifier, **DOCSTRING_OPTIONS)
Resources
Resources(css=[],
markdown_extensions={},
plugins=[],
js=[],
assets=[],
packages=[])
Metadata
created:
source_filename: /home/runner/work/mknodes/mknodes/src/mknodes/manual/api_section.py
source_function: _add_page.<locals>._
source_line_no: 168
hide:
- toc
title: Theming